using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// Article_News - 普通新闻 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class IArticleNews<T> :ModelBase<ArticleNews> where T : ArticleNews, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.Newid = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return Newid;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.Newid=dy.Newid;
           this.ContentId=dy.ContentId;
           this.Author=dy.Author;
           this.Source=dy.Source;
           this.TxtId=dy.TxtId;
        } 

        #region 定义属性

     
         /// <summary>
        /// newid
        /// </summary>
        private String _Newid = "";
      
        /// <summary>
        /// newid
        /// </summary>
        public String Newid
        {
            get 
            {
              return   (this._Newid); 
            }

            set 
            {
                    _Newid= value;  
            }
        }
       
     
         /// <summary>
        /// 内容表ID
        /// </summary>
        private String _ContentId = "";
      
        /// <summary>
        /// 内容表ID
        /// </summary>
        public String ContentId
        {
            get 
            {
              return   (this._ContentId); 
            }

            set 
            {
                    _ContentId= value;  
            }
        }
       
     
         /// <summary>
        /// 作者
        /// </summary>
        private String _Author = "";
      
        /// <summary>
        /// 作者
        /// </summary>
        public String Author
        {
            get 
            {
              return   (this._Author); 
            }

            set 
            {
                    _Author= value;  
            }
        }
       
     
         /// <summary>
        /// 来源
        /// </summary>
        private String _Source = "";
      
        /// <summary>
        /// 来源
        /// </summary>
        public String Source
        {
            get 
            {
              return   (this._Source); 
            }

            set 
            {
                    _Source= value;  
            }
        }
       
     
         /// <summary>
        /// 文本ID
        /// </summary>
        private String _TxtId = "";
      
        /// <summary>
        /// 文本ID
        /// </summary>
        public String TxtId
        {
            get 
            {
              return   (this._TxtId); 
            }

            set 
            {
                    _TxtId= value;  
            }
        }
       

      #endregion 定义属性 

          protected internal override void SetValue(ArticleNews info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["Newid"]!= DBNull.Value)
                  {
                  info.Newid=row["Newid"].ToString();
                 }
                 
                  
                  if(row["ContentId"]!= DBNull.Value)
                  {
                  info.ContentId=row["ContentId"].ToString();
                 }
                 
                  
                  if(row["Author"]!= DBNull.Value)
                  {
                  info.Author=row["Author"].ToString();
                 }
                 
                  
                  if(row["Source"]!= DBNull.Value)
                  {
                  info.Source=row["Source"].ToString();
                 }
                 
                  
                  if(row["TxtId"]!= DBNull.Value)
                  {
                  info.TxtId=row["TxtId"].ToString();
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, ArticleNews info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@Newid", DbType.String,ParameterTool.GetObj( info._Newid )); 
            
             
                cn.AddInParameter(comm, "@ContentId", DbType.String,ParameterTool.GetObj( info._ContentId )); 
            
             
                cn.AddInParameter(comm, "@Author", DbType.String,ParameterTool.GetObj( info._Author )); 
            
             
                cn.AddInParameter(comm, "@Source", DbType.String,ParameterTool.GetObj( info._Source )); 
            
             
                cn.AddInParameter(comm, "@TxtId", DbType.String,ParameterTool.GetObj( info._TxtId )); 
            
        } 

    } 
} 